package org.yenn.pattern.aliyun.behavioral.state;

import org.junit.Test;
import org.yenn.pattern.aliyun.behavioral.state.impl.StartState;
import org.yenn.pattern.aliyun.behavioral.state.impl.StopState;

import static org.junit.Assert.*;

/**
 * 步骤 4
 * 使用 Context 来查看当状态 State 改变时的行为变化。
 */
public class StatePatternDemo {

    /**
     * 步骤 5
     * 验证输出。
     *
     * Player is in start state
     * Start State
     *
     * Player is in Stop  state
     * Stop  State
     */
    @Test
    public void doAction() {
        Context context = new Context();

        StartState startState = new StartState();
        startState.doAction(context);

        System.out.println(context);
        System.out.println("");

        StopState stopState = new StopState();
        stopState.doAction(context);

        System.out.println(context);
    }
}